/*----------------------------------------------------------------------------------------
*
*  Copyright 2019, Gao Hai Hui, <fromzeropoint@126.com>.  All rights reserved.
*  https://gitee.com/helloworldghh/xoskit.git
*  Use of this source code is governed by a MIT license
*  that can be found in the License file.
*
----------------------------------------------------------------------------------------*/
#ifndef __37F9D32B_31F4_455b_BEDD_5E9BE1EF8F71__
#define __37F9D32B_31F4_455b_BEDD_5E9BE1EF8F71__

namespace xos_aio
{

    class mgr : public i_aio_mgr
    {
    public:
        typedef xos::release_impl< mgr > T;

    public:
        mgr();
        ~mgr();

    public:
        static int static_init( xos_container::i_container * pContainer, i_aio_mgr ** ppv );
        static xos_container::i_container * container();
        static mgr * get();

    public:
        // 
        // 设置最大投递的accept,recv,send数量。
        // 0表示默认
        // 只在windows下有效，其它平台下无用
        // 
        int set_tcp_max_post_num( int nMaxPostAcceptNum, int nMaxPostRecvNum, int nMaxPostSendNum );
        int set_udp_max_post_num( int nMaxPostRecvNum, int nMaxPostSendNum );
        // 
        // set callback thread. all aios use ONE callback thread.
        // 
        int set_callback_thread( xos_box::i_callback * pCallbackThread );
        int set_msg_type( int nMsgType );
        i_aio * aio();

    public:
        xos_box::i_notify * notify() const;

    protected:
        xos_box::i_notify * m_pNotify;

    public:
        int put_back_to_pool();
        int init();
        int term();

    };

} // xos_aio

#endif // __37F9D32B_31F4_455b_BEDD_5E9BE1EF8F71__
